import { defineStore } from 'pinia';
import { ref } from 'vue';

export const useEmployeeStore = defineStore('employee', () => {
  const employeeInfo:{
    value?:any
    userid?:string
  } = ref({}); // 存储员工信息
  const dept_name=ref({dept_name:''})
  const types = ref(''); // 存储员工信息


  // 设置员工信息
  const setEmployeeInfo = (info: any) => {
    employeeInfo.value=''
    employeeInfo.value = {...info,...dept_name.value}; // 更新员工信息
  };

  const setEmployeeDeptname=(val:any)=>{
    dept_name.value.dept_name=''
    dept_name.value.dept_name=val
  }

  const settype=(val:any)=>{
    types.value=val;
  }

  return {
    employeeInfo,
    setEmployeeInfo,
    setEmployeeDeptname,
    types,
    settype
  };
}, {
  persist: true, // 启用持久化
}); 